package com.wang;


import com.wang.service.IDemoService;
import com.wang.service.impl.DemoServiceImpl;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.ExtensionLoader;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;
import org.apache.dubbo.registry.NotifyListener;
import org.apache.dubbo.registry.Registry;
import org.apache.dubbo.registry.RegistryFactory;

/**
 * Unit test for simple App.
 */
public class AppTestCategory {

    public static void main(String[] args) throws Exception{
        //获取服务注册中心工厂
        RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension();
        //获取注册实例
        Registry registry = registryFactory.getRegistry(URL.valueOf("nacos://127.0.0.1:8848"));
        //将降级方案注册到注册中心
        //registry.unsubscribe(URL.valueOf("override://0.0.0.0/com.wang.service.IDemoService?category=configurators&dynamic=false&application=dubbo-consumer&mock=fail:return+null&group=dev&version=1.0.0"));
        registry.register(URL.valueOf("dubbo://172.17.5.65/com.wang.service.IDemoService?category=providers&dynamic=false&application=dubbo-consumer&mock=fail:return+null&group=dev&version=1.0.0"));
        Thread.currentThread().join();
    }

}
